import java.util.Scanner;

/**
   Counts the number of digits with value 7 in the decimal 
   representation of the integer n
*/
public class CountSevens
{
   public static void main(String[] args)
   {
      Scanner in = new Scanner(System.in);
      int n = in.nextInt();

      // your work here
      int count = 0;
      while(n != 0){
         if(n%10 == 7)
         count ++;
         n /= 10;
      }



      System.out.println(count);
   }
}